<?php

namespace App\Http\Controllers\Api;

use App\Jobs\NoticeJob;
use App\Models\Notice;
use App\Models\Renting;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class NoticeController extends Controller
{
    public function index(Request $request){
        $openid = $request->get('openid');
        //通过openid查询id

        $renting_id = Renting::where('openid',$openid)->value('id');
        //查询此用户的看房通知表
        $data = Notice::where('renting_id',$renting_id)->with('owner')->orderBy('id','desc')->get();
        return $data;
    }
}
